//
//  SysInfo.m
//  StoneMason
//
//  Created by iOS1 on 16/12/5.
//  Copyright © 2016年 iOS1. All rights reserved.
//

#import "SysInfo.h"
#import "SMUtil.h"
#import "ToolHelper.h"
@implementation SysInfo

+(NSString *)getVersion {
    NSDictionary *infoDic = [[NSBundle mainBundle] infoDictionary];
    NSString *currentVersion = [infoDic objectForKey:@"CFBundleShortVersionString"];
    return currentVersion;
}

+(BOOL)isFirstLoginInVersion {
    BOOL isNotFirstLogin = [[ToolHelper userDefaultsForKey:ISFIRSTLOGIN] boolValue];
    NSString *versonSaved = [ToolHelper userDefaultsForKey:APPVERSON];
    NSString *verson = [self getVersion];
    
    if( !isNotFirstLogin || ![verson isEqualToString:versonSaved]) {
        [ToolHelper setUserDefault:@"YES" forKey:ISFIRSTLOGIN];
        [ToolHelper setUserDefault:verson forKey:APPVERSON];
        return YES;
    }
    else return NO;
}

+(NSString *)getAppName {
    NSDictionary *infoDic = [[NSBundle mainBundle] infoDictionary];
    NSString *appName = [infoDic objectForKey:@"CFBundleName"];
    return appName;
}

@end
